#ifndef SSY_CURL_PACKAGE_H
#define SSY_CURL_PACKAGE_H


#include "curl.h"

#define PATH_MAX 256

#ifdef __cplusplus
extern "C" {
#endif

	void Curl_Init(void);
	void Curl_Uninit(void);
	bool Curl_DelFile(const char *remote_path);
	bool Curl_DelDir(const char *remote_dir);
	bool Curl_DelEmptyDir(const char *remote_dir);
	bool Curl_Upload(const char *local_path, const char *remote_path);
	bool Curl_Dwonload(const char *remote_path, const char *local_path, int timeout_ms);
	bool Curl_DownloadWildcard(const char *remote_path, const char *local_dir, 
		int (*Filter)(struct curl_fileinfo *finfo, int remains), 
		int (*CombPath)(struct curl_fileinfo *finfo, const char *ldir, const void *remaindata, char *lpath, int lsize), 
		int timeout_ms, const void *remaindata);

#ifdef __cplusplus
};
#endif


#endif // SSY_CURL_PACKAGE_H

/*-----------------------------------------------------------------
int Filter(struct curl_fileinfo *finfo, int remains) {
	char *gbkname = (char *)malloc(256);
	UTF8ToGBK(finfo->filename, gbkname, 256);
	printf("%3d %10luB %s %s\n", remains, (unsigned long)finfo->size, finfo->b_data, gbkname);
	free(gbkname);
	if (finfo->size > 50*240) {
		return 1; 
	}
	return 0; // >0:true  <=0:false
}

int CombPath(struct curl_fileinfo *finfo, const char *rpath, const char *ldir, char *lpath, int lsize) {
	char *gbkname = (char *)malloc(256);
	UTF8ToGBK(finfo->filename, gbkname, 256);
	if (NULL == ldir)
		strcpy(lpath, gbkname);
	else {
		sprintf(lpath, "%s\\%s_test.jpg", ldir, gbkname);
	}	
	free(gbkname);
	return 0; // >0:true  <=0:false
}
--------------------------------------------------------------------*/

